You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interview Problem: Find Missing Number in a sorted array (Problem1.java)
Strengths:
Correct binary search approach for finding the missing number
Proper use of loop termination condition (R - L) > 1
Correct handling of index comparisons
Areas for Improvement:
Critical Bug: Typo in method name - searrch (three r's) vs search (called in main). This causes a compilation error.
Formatting: Code lacks proper indentation and spacing, making it harder to read.
Descriptive Names: Variable names like L, R, mid are acceptable but could be more descriptive (e.g., left, right).
Comments: No comments explaining the logic, which would help understanding.
Input Flexibility: Unlike the reference solution, this hardcodes the test array. Consider making it more flexible.
Recommended Fix:
Rename searrch to search to fix the compilation error.
VERDICT: NEEDS_IMPROVEMENT
Interview Problem: Design Min Heap
Wrong Problem: The submitted solution solves a different problem (finding missing number in sorted array) rather than implementing a Min Heap as specified in the problem statement.
Syntax Errors: The function is named searrch but called as search in main, which would cause a compilation error.
Missing Required Operations: The problem requires implementing getMin(), extractMin(), and insert() operations for a Min Heap - none of which are present in this solution.
No Heap Implementation: There's no heap array, no parent/child index calculations, no heapify logic, or any of the core Min Heap operations.
What to Do: To improve, the student needs to:
Read the problem carefully and understand what is being asked
Implement a complete binary tree structure using an array
Implement helper methods for parent, left child, right child indices
Implement the insert() method with upward bubbling (sift-up)
Implement the extractMin() method with downward bubbling (sift-down/heapify)
Include proper error handling for edge cases (empty heap, full heap)
VERDICT: NEEDS_IMPROVEMENT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.